import requests
from Crypto.Cipher import DES
from Crypto.Util.Padding import pad, unpad     # 填充
import base64


headers = {
    "Accept": "application/json, text/plain, */*",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "Cache-Control": "no-cache",
    "Connection": "keep-alive",
    "Pragma": "no-cache",
    "Referer": "https://ctbpsp.com/",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-origin",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",
    "sec-ch-ua-mobile": "?0",
}
url = "https://ctbpsp.com/cutominfoapi/searchkeyword?keyword=11&uid=0&PageSize=10&CurrentPage=1&searchType=0&bulletinType=5&type__1017=n4Ix9DBD2D0Ai=NeGXE4CqGI5hxRr20DiIQqdx"


response = requests.get(url, headers=headers)

print(response.text)
print(response)

mi_s = response.text
mi = base64.b64decode(mi_s)
des = DES.new(key = '1qaz@wsx'.encode('utf-8'), mode=DES.MODE_ECB)
# 解密
ming = des.decrypt(mi)
# 去除填充
decrypted = unpad(ming, 8, style='pkcs7')
ming_s = decrypted.decode("utf-8")
print(ming_s)